package sdk
Import Path
github.com/K-Phoen/sdk (on go.dev)
Dependency Relation
imports 7 packages, and imported by 35 packages
Involved Source Files
alert-manager.go
alert.go
board.go
custom-types.go
datasource.go
panel.go
row.go
Package-Level Type Names (total 90)
Evaluator AlertEvaluator
Operator AlertOperator
Query AlertConditionQueryRef
Reducer AlertReducer
Type string
DashboardTags []string
Limit int
NameFilter string
OnlyAlertsOnDashboard bool
Show string
SortOrder int
StateFilter []string
Conditions []AlertCondition
Datasource AlertDatasourceRef
Expr string
Format string
Hide *bool
Interval string
IntervalMs int
LegendFormat string
For Stackdriver
QueryType string
RefID string
For Graphite
Type string
type AlertObjectMatcher ([...])
DatasourceUID string
Model AlertModel
QueryType string
RefID string
RelativeTimeRange *AlertRelativeTimeRange
// seconds
// seconds
Datasource *DatasourceRef
Enable bool
Expr string
IconColor string
IconSize uint
LineColor string
Name string
Query string
ShowLine bool
Step string
TagKeys string
Tags []string
TagsField string
TextField string
TextFormat string
TitleFormat string
Type string
for a graph panel
Decimals int
Format string
Label string
LogBase int
Max *FloatString
Min *FloatString
Show bool
Board represents Grafana dashboard.
Annotations struct{List []Annotation}
Editable bool
GraphTooltip int
HideControls bool
ID uint
Links []Link
OriginalTitle string
Panels []*Panel
Refresh *BoolString
Rows []*Row
SchemaVersion uint
SharedCrosshair bool
Slug string
Style string
Tags []string
Templating Templating
Time Time
Timepicker Timepicker
Timezone string
Title string
UID string
Version uint
(*Board) AddLink(link Link)
(*Board) AddRow(title string) *Row
(*Board) AddTags(tags ...string)
(*Board) HasTag(tag string) bool
(*Board) RemoveTags(tags ...string)
(*Board) UpdateSlug() string
func NewBoard(title string) *Board
func github.com/K-Phoen/grabana/dashboard.(*Builder).Internal() *Board
func github.com/K-Phoen/grabana/row.New(board *Board, title string, options ...row.Option) (*row.Row, error)
Flag bool
Value *int64
( BoolInt) MarshalJSON() ([]byte, error)
(*BoolInt) UnmarshalJSON(raw []byte) error
BoolInt : github.com/goccy/go-json.Marshaler
*BoolInt : github.com/goccy/go-json.Unmarshaler
BoolInt : encoding/json.Marshaler
*BoolInt : encoding/json.Unmarshaler
Flag bool
Value string
( BoolString) MarshalJSON() ([]byte, error)
(*BoolString) UnmarshalJSON(raw []byte) error
BoolString : github.com/goccy/go-json.Marshaler
*BoolString : github.com/goccy/go-json.Unmarshaler
BoolString : encoding/json.Marshaler
*BoolString : encoding/json.Unmarshaler
for a table
Alias *string
ColorMode *string
Colors *[]string
DateFormat *string
Decimals *int
Link bool
LinkTargetBlank bool
LinkTooltip *string
LinkUrl *string
MappingType int
Pattern string
Thresholds *[]string
Type string
Unit *string
ValueMaps []ValueMap
// metrics
// general
Editable bool
Error bool
GridPos struct{H *int; W *int; X *int; Y *int}
// general
HideTimeOverride *bool
ID uint
IsNew bool
// general
// templating options
// it required for defining type of the panel
// display styles
// templating options
RepeatDirection *RepeatDirection
RepeatIteration *int64 `json:"repeatIteration,omitempty"`
ScopedVars map[string]struct{Selected bool; Text string; Value string}
// general
// general
Transparent bool
Type string
DisableResolveMessage bool
Name string
SecureSettings map[string]interface{}
Settings map[string]interface{}
Type string
UID string
for templateVar
Tags []*string
Text *StringSliceString
// TODO select more precise type
FolderID int
Headings bool
Limit int
Mode string
Query string
Recent bool
Search bool
Starred bool
Tags []string
func (*Row).AddDashlist(data *DashlistPanel)
Datasource as described in the doc
http://docs.grafana.org/reference/http_api/#get-all-datasources
// direct or proxy
BasicAuth *bool
BasicAuthPassword *string
BasicAuthUser *string
Database *string
ID uint
IsDefault bool
JSONData interface{}
Name string
OrgID uint
Password *string
SecureJSONData interface{}
Type string
URL string
User *string
WithCredentials bool
DatasourceRef is used to reference a datasource from panels, queries, etc.
LegacyName is the old way of referencing a datasource by its name, replaced in Grafana v8.4.3 by Type and UID referencing.
If datasource is encoded as a string, then it's unmarshaled into this LegacyName field (Type and UID will be empty).
If LegacyName is not empty, then this DatasourceRef will be marshaled as a string, ignoring the values of Type and UID.
Type describes the type of the datasource, like "prometheus", "graphite", etc.
Datasources of the same type should support same queries.
If Type is empty in an unmarshaled DatasourceRef, check the LegacyName field.
UID is the uid of the specific datasource this references to.
( DatasourceRef) MarshalJSON() ([]byte, error)
(*DatasourceRef) UnmarshalJSON(data []byte) error
DatasourceRef : github.com/goccy/go-json.Marshaler
*DatasourceRef : github.com/goccy/go-json.Unmarshaler
DatasourceRef : encoding/json.Marshaler
*DatasourceRef : encoding/json.Unmarshaler
Datasource type as described in
http://docs.grafana.org/reference/http_api/#available-data-source-types
Metrics bool
Module string
Name string
Partials struct{Query string}
PluginType string
ServiceName string
Type string
Defaults FieldConfigDefaults
Overrides []FieldConfigOverride
func github.com/K-Phoen/grabana/scheme.New(fieldConfig *FieldConfig, options ...scheme.Option) *scheme.Scheme
func github.com/K-Phoen/grabana/timeseries/axis.New(fieldConfig *FieldConfig, options ...axis.Option) (*axis.Axis, error)
func github.com/K-Phoen/grabana/timeseries/threshold.New(fieldConfig *FieldConfig, options ...threshold.Option) *threshold.Threshold
AxisLabel string
AxisPlacement string
AxisSoftMax *int
AxisSoftMin *int
BarAlignment int
DrawStyle string
FillOpacity int
GradientMode string
HideFrom struct{Legend bool; Tooltip bool; Viz bool}
LineInterpolation string
LineStyle struct{Fill string}
LineWidth int
PointSize int
ScaleDistribution struct{Type string; Log int}
ShowPoints string
SpanNulls bool
Stacking struct{Group string; Mode string}
ThresholdsStyle struct{Mode string}
Color FieldConfigColor
Custom FieldConfigCustom
Decimals *int
Links []Link
Max *float64
Min *float64
NoValue string
Thresholds Thresholds
Unit string
Matcher struct{ID string; Options string}
Properties []FieldConfigOverrideProperty
FloatString represents special type for json values that could be strings or ints: 100 or "100"
Valid bool
Value float64
MarshalJSON implements custom marshalling for FloatString type
UnmarshalJSON implements custom unmarshalling for FloatString type
*FloatString : github.com/goccy/go-json.Marshaler
*FloatString : github.com/goccy/go-json.Unmarshaler
*FloatString : encoding/json.Marshaler
*FloatString : encoding/json.Unmarshaler
func NewFloatString(i float64) *FloatString
for a stat
MaxValue float32
MinValue float32
Show bool
ThresholdLabels bool
ThresholdMarkers bool
// XXX
Bars bool
DashLength *uint
Dashes *bool
Decimals *int
FieldConfig *FieldConfig
Fill int
LeftYAxisLabel *string
Legend Legend
Lines bool
Linewidth uint
NullPointMode string
Percentage bool
Pointradius float32
Points bool
RightYAxisLabel *string
SeriesOverrides []SeriesOverride
SpaceLength *uint
Stack bool
SteppedLine bool
Targets []Target
Thresholds []Threshold
TimeFrom *string
TimeShift *string
Tooltip Tooltip
XAxis bool
// was added in Grafana 4.x?
YAxis bool
YFormats []string
// was added in Grafana 4.x?
func (*Row).AddGraph(data *GraphPanel)
Cards struct{CardPadding *float64; CardRound *float64}
Color struct{CardColor string; ColorScale string; ColorScheme string; Exponent float64; Min *float64; Max *float64; Mode string}
DataFormat string
HideZeroBuckets bool
HighlightCards bool
Legend struct{Show bool}
ReverseYBuckets bool
Targets []Target
Tooltip struct{Show bool; ShowHistogram bool}
TooltipDecimals int
XAxis struct{Show bool}
XBucketNumber *float64
XBucketSize *string
YAxis struct{Decimals *int; Format string; LogBase int; Show bool; Max *string; Min *string; SplitFactor *float64}
YBucketBound string
YBucketNumber *float64
YBucketSize *float64
Height of rows maybe passed as number (ex 200) or
as string (ex "200px") or empty string
(*Height) UnmarshalJSON(raw []byte) error
*Height : github.com/goccy/go-json.Unmarshaler
*Height : encoding/json.Unmarshaler
IntString represents special type for json values that could be strings or ints: 100 or "100"
Valid bool
Value int64
MarshalJSON implements custom marshalling for IntString type
UnmarshalJSON implements custom unmarshalling for IntString type
*IntString : github.com/goccy/go-json.Marshaler
*IntString : github.com/goccy/go-json.Unmarshaler
*IntString : encoding/json.Marshaler
*IntString : encoding/json.Unmarshaler
func NewIntString(i int64) *IntString
for a graph panel
AlignAsTable bool
Avg bool
Current bool
HideEmpty bool
HideZero bool
Max bool
Min bool
RightSide bool
Show bool
SideWidth *uint
Total bool
Values bool
Link represents link to another dashboard or external weblink
AsDropdown *bool
DashURI *string
Dashboard *string
Icon *string
IncludeVars bool
KeepTime *bool
Params *string
Tags []string
TargetBlank *bool
Title string
Tooltip *string
Type string
URL *string
func (*Board).AddLink(link Link)
DedupStrategy string
EnableLogDetails bool
PrettifyLogMessage bool
ShowCommonLabels bool
ShowLabels bool
ShowTime bool
SortOrder string
WrapLogMessage bool
Map of template name → template
Default group bys
Default timing settings
GroupWait string
Default alert receiver
RepeatInterval string
Routing policies
Default timing settings overrides
GroupWait string
ObjectMatchers []AlertObjectMatcher
Alert receiver
RepeatInterval string
ColorMode string
Content string
DisplayMode string
GraphMode string
JustifyMode string
Mode string
Orientation string
ReduceOptions ReduceOptions
Text *TextOptions
TextMode string
Panel represents panels of different types defined in Grafana.
AlertlistPanel *AlertlistPanel
AlertlistPanel.DashboardTags []string
AlertlistPanel.NameFilter string
AlertlistPanel.OnlyAlertsOnDashboard bool
AlertlistPanel.Show string
AlertlistPanel.SortOrder int
AlertlistPanel.StateFilter []string
BarGaugePanel *BarGaugePanel
CommonPanel CommonPanel
// metrics
// general
CommonPanel.Editable bool
CommonPanel.Error bool
CommonPanel.GridPos struct{H *int; W *int; X *int; Y *int}
// general
CommonPanel.HideTimeOverride *bool
CommonPanel.ID uint
CommonPanel.IsNew bool
// general
// templating options
// it required for defining type of the panel
// display styles
// templating options
CommonPanel.RepeatDirection *RepeatDirection
RepeatIteration *int64 `json:"repeatIteration,omitempty"`
CommonPanel.ScopedVars map[string]struct{Selected bool; Text string; Value string}
// general
// general
CommonPanel.Transparent bool
CommonPanel.Type string
CustomPanel *CustomPanel
DashlistPanel *DashlistPanel
DashlistPanel.FolderID int
DashlistPanel.Headings bool
DashlistPanel.Query string
DashlistPanel.Recent bool
DashlistPanel.Search bool
DashlistPanel.Starred bool
DashlistPanel.Tags []string
GaugePanel *GaugePanel
Should be initialized only one type of panels.
OfType field defines which of types below will be used.
// XXX
GraphPanel.Bars bool
GraphPanel.DashLength *uint
GraphPanel.Dashes *bool
GraphPanel.Fill int
GraphPanel.LeftYAxisLabel *string
GraphPanel.Lines bool
GraphPanel.Linewidth uint
GraphPanel.Percentage bool
GraphPanel.Pointradius float32
GraphPanel.Points bool
GraphPanel.RightYAxisLabel *string
GraphPanel.SeriesOverrides []SeriesOverride
GraphPanel.SpaceLength *uint
GraphPanel.Stack bool
GraphPanel.SteppedLine bool
GraphPanel.TimeFrom *string
GraphPanel.TimeShift *string
// was added in Grafana 4.x?
GraphPanel.YFormats []string
// was added in Grafana 4.x?
HeatmapPanel *HeatmapPanel
HeatmapPanel.Cards struct{CardPadding *float64; CardRound *float64}
HeatmapPanel.Color struct{CardColor string; ColorScale string; ColorScheme string; Exponent float64; Min *float64; Max *float64; Mode string}
HeatmapPanel.DataFormat string
HeatmapPanel.HideZeroBuckets bool
HeatmapPanel.HighlightCards bool
HeatmapPanel.ReverseYBuckets bool
HeatmapPanel.TooltipDecimals int
HeatmapPanel.XBucketNumber *float64
HeatmapPanel.XBucketSize *string
HeatmapPanel.YBucketBound string
HeatmapPanel.YBucketNumber *float64
HeatmapPanel.YBucketSize *float64
LogsPanel *LogsPanel
PluginlistPanel *PluginlistPanel
RowPanel *RowPanel
RowPanel.Collapsed bool
RowPanel.Panels []Panel
SinglestatPanel *SinglestatPanel
SinglestatPanel.ColorBackground bool
SinglestatPanel.ColorValue bool
SinglestatPanel.Colors []string
SinglestatPanel.Format string
SinglestatPanel.Gauge Gauge
SinglestatPanel.MappingType *uint
SinglestatPanel.MappingTypes []*MapType
SinglestatPanel.MaxDataPoints *IntString
SinglestatPanel.Postfix *string
SinglestatPanel.PostfixFontSize *string
SinglestatPanel.Prefix *string
SinglestatPanel.PrefixFontSize *string
SinglestatPanel.RangeMaps []*RangeMap
SinglestatPanel.SparkLine SparkLine
SinglestatPanel.ValueFontSize string
SinglestatPanel.ValueMaps []ValueMap
SinglestatPanel.ValueName string
StatPanel *StatPanel
TablePanel *TablePanel
TablePanel.Columns []Column
TablePanel.Transform string
TextPanel *TextPanel
TextPanel.Content string
TextPanel.PageSize uint
TextPanel.ShowHeader bool
TimeseriesPanel *TimeseriesPanel
AddTarget adds a new target as defined in the argument
but with refId letter incremented. Value of refID from
the argument will be used only if no target with such
value already exists.
GetTargets iterates over all panel targets. It just returns nil if
no targets defined for panel of concrete type.
(*Panel) MarshalJSON() ([]byte, error)
MapDatasources on all existing targets for the panel.
RepeatTargetsForDatasources repeats all existing targets for a panel
for all provided in the argument datasources. Existing datasources of
targets are ignored.
ResetTargets delete all targets defined for a panel.
SetTarget updates a target if target with such refId exists
or creates a new one.
(*Panel) UnmarshalJSON(b []byte) error
*Panel : github.com/goccy/go-json.Marshaler
*Panel : github.com/goccy/go-json.Unmarshaler
*Panel : encoding/json.Marshaler
*Panel : encoding/json.Unmarshaler
func NewAlertlist(title string) *Panel
func NewCustom(title string) *Panel
func NewDashlist(title string) *Panel
func NewGauge(title string) *Panel
func NewGraph(title string) *Panel
func NewHeatmap(title string) *Panel
func NewLogs(title string) *Panel
func NewPluginlist(title string) *Panel
func NewSinglestat(title string) *Panel
func NewStat(title string) *Panel
func NewTable(title string) *Panel
func NewText(title string) *Panel
func NewTimeseries(title string) *Panel
func (*Row).Add(panel *Panel)
func github.com/K-Phoen/grabana/gauge.RepeatDirection(direction RepeatDirection) gauge.Option
func github.com/K-Phoen/grabana/graph.RepeatDirection(direction RepeatDirection) graph.Option
func github.com/K-Phoen/grabana/heatmap.RepeatDirection(direction RepeatDirection) heatmap.Option
func github.com/K-Phoen/grabana/logs.RepeatDirection(direction RepeatDirection) logs.Option
func github.com/K-Phoen/grabana/singlestat.RepeatDirection(direction RepeatDirection) singlestat.Option
func github.com/K-Phoen/grabana/stat.RepeatDirection(direction RepeatDirection) stat.Option
func github.com/K-Phoen/grabana/timeseries.RepeatDirection(direction RepeatDirection) timeseries.Option
const RepeatDirectionHorizontal
const RepeatDirectionVertical
Row represents single row of Grafana dashboard.
Collapse bool
Editable bool
Height Height
Panels []Panel
Repeat *string
ShowTitle bool
Title string
(*Row) Add(panel *Panel)
(*Row) AddCustom(data *CustomPanel)
(*Row) AddDashlist(data *DashlistPanel)
(*Row) AddGraph(data *GraphPanel)
(*Row) AddSinglestat(data *SinglestatPanel)
(*Row) AddStat(data *StatPanel)
(*Row) AddTable(data *TablePanel)
(*Row) AddText(data *TextPanel)
func (*Board).AddRow(title string) *Row
for a graph panel
Alias string
Bars *bool
Color *string
Dashes *bool
Fill *int
FillBelowTo *string
Legend *bool
LineWidth *int
Lines *bool
NullPointMode *string
Stack *BoolString
Transform *string
YAxis *int
ZIndex *int
ColorBackground bool
ColorValue bool
Colors []string
Decimals int
Format string
Gauge Gauge
MappingType *uint
MappingTypes []*MapType
MaxDataPoints *IntString
NullPointMode string
Postfix *string
PostfixFontSize *string
Prefix *string
PrefixFontSize *string
RangeMaps []*RangeMap
SparkLine SparkLine
Targets []Target
Thresholds string
ValueFontSize string
ValueMaps []ValueMap
ValueName string
func (*Row).AddSinglestat(data *SinglestatPanel)
AliasBy string
AlignOptions []StackdriverAlignOptions
AlignmentPeriod string
CrossSeriesReducer string
Filters []string
GroupBys []string
MetricKind string
MetricType string
PerSeriesAligner string
Preprocessor string
ProjectName string
ValueType string
StackdriverAlignOption defines a single alignment option shown in Grafana
during query configuration.
Label string
MetricKinds []string
Text string
Value string
ValueTypes []string
StackdriverAlignOptions defines the list of alignment options shown in
Grafana during query configuration.
Expanded bool
Label string
Options []StackdriverAlignOption
ColorMode string
GraphMode string
JustifyMode string
Orientation string
ReduceOptions ReduceOptions
Text *TextOptions
TextMode string
FieldConfig FieldConfig
Options StatOptions
Targets []Target
func (*Row).AddStat(data *StatPanel)
StringSliceString represents special type for json values that could be
strings or slice of strings: "something" or ["something"].
Valid bool
Value []string
MarshalJSON implements custom marshalling for StringSliceString type.
UnmarshalJSON implements custom unmarshalling for StringSliceString type.
*StringSliceString : github.com/goccy/go-json.Marshaler
*StringSliceString : github.com/goccy/go-json.Unmarshaler
*StringSliceString : encoding/json.Marshaler
*StringSliceString : encoding/json.Unmarshaler
Columns []Column
// from grafana 3.x
Sort *Sort
Styles []ColumnStyle
Targets []Target
Transform string
func (*Row).AddTable(data *TablePanel)
for an any panel
Alias string
AliasBy string
AlignOptions []StackdriverAlignOptions
AlignmentPeriod string
BucketAggs []struct{ID string; Field string; Type string; Settings struct{Interval string; MinDocCount interface{}; Order string; OrderBy string; Size string}}
CrossSeriesReducer string
Datasource *DatasourceRef
Dimensions map[string]string
For Elasticsearch
For Prometheus
Filters []string
Format string
Group []struct{Type string; Params []string}
GroupBys []string
Hide bool
Instant bool
Interval string
IntervalFactor int
LegendFormat string
For InfluxDB
MetricColumn string
MetricKind string
MetricName string
MetricType string
Metrics []struct{ID string; Field string; Type string}
For CloudWatch
PerSeriesAligner string
Period string
Preprocessor string
For the Stackdriver data source. Find out more information at
https:/grafana.com/docs/grafana/v6.0/features/datasources/stackdriver/
Query string
RawQuery bool
RawSql string
RefID string
Region string
Select [][]struct{Params []string; Type string}
Statistics []string
Step int
For PostgreSQL
Tags []struct{Key string; Operator string; Value string}
For Graphite
TimeColumn string
TimeField string
ValueType string
Where []struct{Type string; Name string; Params []string; Datatype string}
func (*Panel).GetTargets() *[]Target
func (*Panel).AddTarget(t *Target)
func (*Panel).SetTarget(t *Target)
AllFormat string
AllValue string
Auto bool
AutoCount *int
Current Current
Datasource *DatasourceRef
Hide uint8
IncludeAll bool
Label string
Multi bool
MultiFormat string
Name string
Options []Option
Query interface{}
Refresh BoolInt
Regex string
Sort int
Type string
Content string
FieldConfig FieldConfig
Mode string
Options struct{Content string; Mode string}
PageSize uint
Scroll bool
ShowHeader bool
Sort Sort
Styles []ColumnStyle
func (*Row).AddText(data *TextPanel)
Package-Level Functions (total 16)
func NewAlertlist(title string) *Panel
NewCustom initializes panel with a stat panel.
NewDashlist initializes panel with a dashlist panel.
func NewFloatString(i float64) *FloatString
NewGauge initializes a new panel as a Gauge panel.
NewGraph initializes panel with a graph panel.
func NewHeatmap(title string) *Panel func NewIntString(i int64) *IntString
NewLogs initializes a new panel as a Logs panel.
NewPluginlist initializes panel with a stat panel.
NewSinglestat initializes panel with a singlestat panel.
NewStat initializes panel with a stat panel.
NewTable initializes panel with a table panel.
NewText initializes panel with a text panel.
NewTimeseries initializes panel with a timeseries panel.
Package-Level Constants (total 21)
Each panel may be one of these types.
Each panel may be one of these types.
Each panel may be one of these types.
Each panel may be one of these types.
Each panel may be one of these types.
Each panel may be one of these types.
Each panel may be one of these types.
Each panel may be one of these types.
const MixedSource = "-- Mixed --"
Each panel may be one of these types.
const RepeatDirectionHorizontal RepeatDirection = "h" const RepeatDirectionVertical RepeatDirection = "v"
Each panel may be one of these types.
Each panel may be one of these types.
Each panel may be one of these types.
Each panel may be one of these types.
Constants for templating
Constants for templating
Constants for templating
Each panel may be one of these types.
Each panel may be one of these types.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |